template 'form',
	labelsPosition:'ASIDE'

template 'table',
	parent:'decoratedView'
	

/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for User
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 ('User.view')
	
table ('User.table',
	readOnly:true,
	actionMap:'filterableBeanCollectionModuleActionMap',
	columns:['firstName', 'lastName', 'position', 'email', 'mobile', 'birth_date', 'login'],
	rowAction:'User.editAction'
)

action 'User.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'User.edit.view']
	

form ('User.edit.view',
	fields:['firstName', 'lastName', 'position', 'email', 'mobile', 'birth_date', 'login', 'password'],
	columnCount:1
)
	
			
	
/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for Equipments
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
split_vertical ('Equipments.view',
	cascadingModels:true,
	top :'Equipments.table',
	bottom :'Equipments.tab.pane'
)

tabs ('Equipments.tab.pane',
		views:[
	       'Equipments-maintenances.table',
	       'Equipments-lendings.table'
	    ]
)
		
table ('Equipments.table',
	readOnly:true,
	actionMap:'filterableBeanCollectionModuleActionMap', 
	columns:['referenceNumber', 'name', 'model', 'manufacturer', 'type', 'lastUpdateTimestamp'],
	rowAction:'Equipments.editAction'
)

table ('Equipments-maintenances.table',
	readOnly:true,
	columns:['name', 'active', 'interval_in_days', 'last_execution', 'days_left'],
	rowAction:'Maintenance.editAction',
	actionMap:'masterDetailActionMap'
)

table ('Equipments-lendings.table',
	readOnly:true,
	selectionMode:'SINGLE_SELECTION',
	columns:['referenceNumber', 'contact_name', 'contact_phone', 'contact_email', 'scheduled_date_out', 'scheduled_date_in', 'outgoing_date', 'incoming_date'],
	rowAction:'Lendig.editAction') 
    actionMap { actionList('View') { action ref:'Lendig.editAction' } }

form ('Equipments.edit.view', 
	fields:['referenceNumber', 'name', 'model', 'manufacturer', 'type', 'details'],
	columnCount:1
)

action 'Equipments.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'Equipments.edit.view']

	

/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for Lendings
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
table ('Lending.table',
	readOnly:true,
	actionMap:'filterableBeanCollectionModuleActionMap',
	rowAction:'Lendig.editAction',
	columns:['referenceNumber', 'contact_name', 'contact_phone', 'contact_email', 
		'scheduled_date_out', 'scheduled_date_in', 'outgoing_date', 'incoming_date', 'lastUpdateTimestamp']
)

table ('Lending-equipments.table',
	readOnly:true,
	columns:['referenceNumber', 'name', 'model', 'manufacturer', 'type', 'lastUpdateTimestamp'],
	actionMap:'Lending-Equipments-actionMap'
)

split_vertical ('Lending.view',
	cascadingModels:true,
	top :'Lending.table',
	bottom :'Lending-equipments.table'
)

form ('Lending.edit.view',
	model:'Lending',
	fields:['referenceNumber', 'contact_name', 'contact_phone', 'contact_email', 'additional_info', 'scheduled_date_out', 'scheduled_date_in', 
		'outgoing_date', 'incoming_date', 'tested_on_lending', 'tested_on_return','executed_by', 'test_remarks'],
	columnCount:1
)

actionMap('Lending-Equipments-actionMap') {
	actionList('EDIT') {
	  action(parent:'pickupAndAddAnyFrontAction', custom:[entityDescriptor_ref:'Equipments'])
	  action(ref:'removeAnyCollectionFromMasterFrontAction')
	}
  }

action 'Lendig.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'Lending.edit.view']
	
	

/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for Maintenances
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
table ('Maintenance.table',
	readOnly:true,
	actionMap:'filterableBeanCollectionModuleActionMap',
	rowAction:'Maintenance.editAction',
	columns:['equipment.name', 'name', 'interval_in_days', 'active', 'last_execution', 'days_left', 'lastUpdateTimestamp']
)

split_vertical ('Maintenance.view',
	cascadingModels:true,
	top :'Maintenance.table',
	bottom :'Maintenance-executions.table'
)
	
form ('Maintenance.edit.view',
	fields:['name', 'interval_in_days', 'active', 'description', 'lastUpdateTimestamp'],
	columnCount:1
)

action 'Maintenance.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'Maintenance.edit.view']


	
/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for MaintenanceExecution
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
table ('Maintenance-executions.table',
	actionMap:'masterDetailActionMap',
	rowAction:'MaintenanceExecution.editAction',
	columns:['maintenance.name', 'passed', 'maintenance_date', 'executed_by'],
	//readOnly:true
)

form ('MaintenanceExecution.edit.view',
	fields:['maintenance_date', 'executed_by', 'passed', 'additional_info'],
	columnCount:1
)

action 'MaintenanceExecution.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'MaintenanceExecution.edit.view']
	
	
	
	
/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for ConsumerGoods
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
table ('ConsumerGoods.table',
	readOnly:true,
	columns:['referenceNumber', 'name', 'model', 'manufacturer', 'type', 'min_inventory', 'current_inventory'],
	actionMap:'filterableBeanCollectionModuleActionMap',
	rowAction:'ConsumerGoods.editAction')

split_vertical ('ConsumerGoods.view',
	cascadingModels:true,
	top :'ConsumerGoods.table',
	bottom :'ConsumerGoods-inventory_changes.table'
)

form ('ConsumerGoods.edit.view',
	fields:['referenceNumber', 'name', 'model', 'manufacturer', 'type', 'min_inventory', 'current_inventory', 'details'],
	columnCount:1
)

action 'ConsumerGoods.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'ConsumerGoods.edit.view']
	


/*** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 									Views for InventoryChange
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
table ('ConsumerGoods-inventory_changes.table',
	readOnly:true,
	icon:'transfer.png',
	actionMap:'masterDetailActionMap',
	rowAction:'InventoryChange.editAction',
	//readOnly: true
)

form ('InventoryChange.edit.view',
	icon:'transfer.png',
	model:'InventoryChange',
	fields:['quantity', 'type', 'executed_by', 'additional_info'],
	columnCount:1
)

action 'InventoryChange.editAction',
	parent:'editSelectedComponentAction',
	custom:['viewDescriptor_ref':'InventoryChange.edit.view']
	


